package com.voc.im.controller;

import com.voc.im.bean.UserRoom;
import com.voc.im.model.UserRoomModel;
import io.datafx.controller.FXMLController;
import javafx.fxml.FXML;
import javafx.scene.control.Label;

import javax.annotation.PostConstruct;
import javax.inject.Inject;

@FXMLController("/fxml/main_window_user.fxml")
public class WindowUserController {

    @FXML
    private Label textUserName,textRemarks,textAccount;

    @Inject
    private UserRoomModel userRoomModel;

    @PostConstruct
    public void init() throws Exception {
        UserRoom userRoom = userRoomModel.getUserListProperty().get(userRoomModel.getSelectedUserIndex().get());
        textUserName.textProperty().bindBidirectional(userRoom.nicknameProperty());
        textRemarks.textProperty().bindBidirectional(userRoom.nicknameProperty());
        textAccount.textProperty().bindBidirectional(userRoom.accountProperty());
    }

}
